package name.zuoguoqing.gui.jfx.fxml;

import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.TableView;
import javafx.scene.control.TextField;

public class FXMLTableViewController {
	@FXML
	private TableView<Person> tableView;
	@FXML
	private TextField firstNameField;
	@FXML
	private TextField lastNameField;
	@FXML
	private TextField emailField;
	
	@FXML
	public void addPerson(ActionEvent event) {
		ObservableList<Person> data = tableView.getItems();
		data.add(new Person(firstNameField.getText(), 
				lastNameField.getText(), emailField.getText()));
		
		firstNameField.setText("");
		lastNameField.setText("");
		emailField.setText("");
	}
}
